<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%

try {
Class.forName("com.mysql.jdbc.Driver");
String url="jdbc:mysql://localhost:3306/bookstore";
String username="root";
String password="123";
Connection conn=DriverManager.getConnection(url,username,password);
if(conn!=null){
out.println("lianjiechenggong");
conn.close();

}
else{
out.println("buchenggong");
}
}
catch(ClassNotFoundException e){
e.printStackTrace();
}
catch(SQLException e){
e.printStackTrace();
}




 %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
 function mycheck(){
 if (form2.name.value=="")
 {alert("请输入用户名！");form2.name.focus();return;}
 if(form2.pwd.value=="")
 {alert("请输入密码！");form2.pwd.focus();return;}
 if(form2.yanzheng.value=="")
 {alert("请输入验证码!");form2.yanzheng.focus();return;}
 if(form2.yanzheng.value != form.verifycode2.value)
 {alert("请输入正确的验证码!!");form2.yanzheng.focus();return;}
 form2.submit();
 }
</script>
<link type="text/css" rel="stylesheet" href="css/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

<form id="form1" name="form1" method="post" action="forward"align=right>
  <label for="001"></label>
  <input name="name" type="text" id="001" value="教务处学号" />
   <label for="02"></label>
   <input type="password" name="pwd" id="02" />
  <input type="submit" name="button" id="button" value="登录" />
</form>
<hr/>

<div  id="one">
<div class="one">
<form id=form2 name=form2 action="" method="get">
  <p>
    <label for="textfield">用户名</label>
    <input type="text" name="textfield" id="textfield" />
  </p>
  <p>
    <label for="textfield2">密码</label>
    <input type="text" name="textfield2" id="textfield2" />
  </p>
  <p>
    <label for="textfield3">确认密码</label>
    <input type="text" name="textfield3" id="textfield3" />
  </p>
  <p>
    <label for="textfield4">验证码</label>
   <input name="yanzheng" type="text" class="input2"
						            onKeyDown="if(event.keyCode==13){form2.Submit.focus();}"
									size="8" align="bottom"
									onMouseOver="this.style.background='#F0DAF3';"
									onMouseOut="this.style.background='#FFFFFF'">
									<!-- 设置验证码文本框，并设置鼠标经过的样式 -->
									<%   
                                    int intmethod = (int)( (((Math.random())*11))-1); 
                                    int intmethod2 = (int)( (((Math.random())*11))-1); 
                                    int intmethod3 = (int)( (((Math.random())*11))-1); 
                                    int intmethod4 = (int)( (((Math.random())*11))-1); 
                                    String intsum = intmethod+""+intmethod2+intmethod3+intmethod4; 
                                    //将得到的随机数进行连接
                                   %>
      <input type="hidden" name="verifycode2" value="<%=intsum%>"> <!-- 设置隐藏域,用来做验证比较-->
				<span class="STYLE12"><font size="+3" color="#FF0000"><img src=num/<%=intmethod %>.gif> <img src=num/<%=intmethod2 %>.gif>
				    <!-- 将图片名称与得到的随机数相同的图片显示在页面上  -->
					<img src=num/<%=intmethod3%>.gif> <img src=num/<%=intmethod4 %>.gif></font></span>                              
                                   
  </p>
  <p>
    <input type="submit" name="button2" id="button2" value="注册" />
  </p>
</form>
</div>
</div>

</body>
</html>
</html>
